Task based help

Task based help

Description

Here is few overviews of something like how-to:

Obtain list of available languages.

A list of available languages can be obtained from TbsPolyglotManager class through LangCount and Langs properties.

Example:

// fill combo box with available languages
// combo box name is cbLanguages
// PolyglotManager is TbsPolyglotManager component added to the form
var
i: Integer;
begin
  // clear combo box items
  cbLanguages.Items.Clear;
   // enum all languages available in core polyglot and add to combo box
  for i := 0 to PolyglotManager.LangCount - 1 do
  begin
    cbLanguages.Items.Add(PolyglotManager.Langs[i]);
    // set currently selected language as selected item in combo box
    if PolyglotManager.Langs[i] = PolyglotManager.CurrentLang then
      cbLanguages.ItemIndex := i;
  end;
end;

Symbols are not displayed correctly

There are few possible reasons to not display correctly symbols:

  1. Be sure you use right Charset. To see list of Charsets refer LNG File Format or Windows.pas;
  2. It is possible that there is a string like Font.ParentFont=True, so it means that Font ignores your settings and use parent font. So Switch to ParentFont=False;
  3. And finally even if you use right charset there is a possibility that specified font (usually MS Sans Serif) doesn't support chosen charset;
  4. If all above doesn't help it is better contact us for assistance;

Switch to other language at run-time

Switching from one language to other are very simple just change CurrentLang property of TbsPolyglotManager or TbsCorePolyglot. You can obtain an instance of TbsCorePolyglot through class function TbsCorePolyglot.GetCorePolyglot

Translate third party component property that is not localizable

Not all vendors mark properties as Localizable for different reasons (they don't think about localization, component originally developed for Delphi 3 or Delphi 4 and so on). But it is not a problem to translate such property. There are few alternative ways to do it:

Manually add these properties to generated LNG file , see LNG file format for more info (It is easy if it occurs once or twice but it is a big piece of work if this property occurs many times across an application);

Add it to "filter by property name" in Generate LNG file wizard (good way but it is possible that ten other components have property with same name and you don't need to localize them);

The most complex, but the most reliable way is to add properties by your own. Create new design-time package that uses required third party component. And in this package create procedure Register that will register required property in Localizable group.

procedure Register;
begin
  RegisterPropertiesInCategory('Localizable', TBsTaskBar, ['LeftCaption', 'ActiveCaption']);
end;

Resourcestrings are messed

It means that you need update resource string translations, don't worry you will not lose your translations. If you change program code then resourcestring ids can be changed and you need to run "LNG Generate Wizard" to update resource strings. Read more about resourcestrings